import UUID, string

def replace(template, mapping_dict, out_file):
    lines = template.readlines()
    for l in lines:
        n = l    
        for k, v in mapping_dict.iteritems():
            n = string.replace(n, k, v() )
        out_file.write( n )
   
